<!-- 子组件 -->
<template>
  <div class="child-1">
    <p>props: {{pChild1}}</p>
    <p>$attrs: {{$attrs}}</p>
    <child2 v-bind="$attrs" v-on="$listeners"></child2>
  </div>
</template>
<script>
import Child2 from './Child2.vue';
export default {
  props: ['pChild1'],
  components: { Child2 },
  inheritAttrs: false,
  mounted () {
    this.$emit('test1'); // 触发父组件中的test1方法
  }
};
</script>

